<template>
  <view class="container">
    <navigationBar :emitBackEvent="true" @backEvent="backHandle" :my-property="navigationBarDataInfo" />
    <view class="main-wrapper"
      :style="[
        {'background-image':(`url(${staticImgs.bg})`)},
        {'height': pageH}
      ]"
    >
          
      <view class="indicate">
        <view v-if="f_visible_1" class="user_hint">回想一下过去的2周</view>
        <view v-if="f_visible_2" class="user_hint">当你遇到以下的场景</view>
        <view v-if="f_visible_3" class="user_hint">更倾向于哪种做法呢？</view>
        <view v-if="f_visible_4" class="user_hint" style="padding-top: 46rpx;">
          <image class="img" :src="staticImgs.pImg" mode="widthFix"></image>
        </view>
      </view>
    
      <view class="start-btn-pos">
        <view class="start-btn" @click="startScl()">
          <text>点击开始电量检测！</text>
          <view class="lighting-pos">
            <image class="img" :src="staticImgs.lightningImg" mode="widthFix"></image>
          </view>
        </view>
      </view>
    </view>
  </view>
</template>

<script>
  var app = getApp();
  export default{
    props:{
      sclInfo: {
        type: Object,
        default: () => {}
      },
    },
    data(){
      return {
        staticImgs:{
          bg: this.imgBaseURL + '/scl/introduce/45/bg.jpg',
          pImg: this.imgBaseURL + '/scl/introduce/45/p.png',
          lightningImg: this.imgBaseURL + '/scl/introduce/45/lightning.png',
        },
        firstTipTextArrVisible: [
          false, false, false, false
        ],
        f_visible_1:false,
        f_visible_2:false,
        f_visible_3:false,
        f_visible_4:false,
        navigationBarDataInfo: {
          "bg_color": "#fff",
          "color": "#333",
          "flag": 1,
          "name": "情绪电量检测",
          "hasEntity": true,
        },
        navH: 0,
        pageH: '100vh'
      }
    },
    watch:{
      sclInfo: {
        handler(val) {
          if (val) {
            this.navigationBarDataInfo.name = val.sclName
          }
        },
        immediate: true
      },
    },
    mounted() {
      this.navH = app.globalData.topHeight// * 2
      
      console.log(app.globalData,'----app.globalData--')
      
      this.pageH = app.globalData.screenHeight - this.navH + 'px'
      
      const _self = this
      console.log('----test-----')
      setTimeout(() => {
        _self.f_visible_1 = true
        console.log('----test-----===1====')
        setTimeout(function() {
          _self.f_visible_2 = true
          setTimeout(function() {
            _self.f_visible_3 = true
            setTimeout(function() {
              _self.f_visible_4 = true
            }, 500);
          }, 500);
        }, 400);
      }, 100);
    },
    methods:{
      startScl(){
        this.$emit('startScl')
      },
      backHandle() {
        this.$emit('backHandle')
      }
    }
  }
</script>

<style lang="scss" scoped>
  @keyframes fadeIn {
    0% {
      opacity: 0;
    }
  
    100% {
      opacity: 1;
    }
  }
  @keyframes shake {
      0% { transform: translate(0); }
      25% { transform: translate(-3px, 3px); }
      50% { transform: translate(3px, -3px); }
      80% { transform: translate(0); }
      // 75% { transform: translate(-5px, 5px); }
      // 100% { transform: translate(0); }
  }
@keyframes stay {
    0% { opacity: 1; }
    100% { opacity: 1; }
}

  
  .container{
    width: 100vw;
    box-sizing: border-box;
    min-height: 100vh;
    height: 100vh;
    position: relative;
  }
    
  .main-wrapper{
    width: 100vw;
    height: 100%;
    background-size: 100% 100%;
    background-repeat: no-repeat;
    position: relative;
    
    .indicate {
      display: flex;
      flex-direction: column;
      position: relative;
      height: 158rpx;
      width: 750rpx;
    
      box-sizing: border-box;
      padding-top: 136rpx;
    
    
      .user_hint {
        opacity: 0;
        animation-fill-mode: forwards;
        animation-name: fadeIn;
        animation-duration: .5s;
    
        width: 100%;
        text-align: center;
        
        font-family: PingFangSC, PingFang SC;
        font-weight: 500;
        font-size: 40rpx;
        color: #FFFFFF;
        line-height: 70rpx;
        font-style: normal;
        
        .img{
          margin-top: 54rpx;
          width: 560rpx;
          height: 80rpx;
          margin: auto;
        }
      }
    
    }
    
  
    .start-btn-pos{
      position: fixed;
      
      bottom: 8vh;
      left: 0;
      right: 0;
      
      .start-btn{
        width: 560rpx;
        height: 110rpx;
        margin: auto;
        
        left: 0;
        right: 0;
        
        border-radius: 56rpx;
        
        display: flex;
        align-items: center;
        box-sizing: border-box;
        padding-left: 120rpx;
        position: relative;
        
        background: linear-gradient(to bottom, #A6B4FE,#8B63F9);
        
        font-family: PingFangSC, PingFang SC;
        font-weight: 400;
        font-size: 34rpx;
        color: #FFFFFF;
        font-style: normal;
        
        .lighting-pos{
          position: absolute;
          // right: 114rpx;
          // top: 34rpx;
              right: 94rpx;
              top: 34rpx;
          
          animation: shake 1.5s infinite; /* 抖动，循环 */
          animation-delay: 3s; /* 延迟4秒后开始动画 */

          .img{
            width: 40rpx;
            height: 40rpx;
          }
        }
      }
    }
  }
</style>